<div class="fui-page fui-page-current " ng-if="pagedata.op=='list'">
    <div class="fui-header">
        <div class="fui-header-left">
            <a class="back" ng-click="goback()"></a>
        </div>
        <div class="title">我的退款申请</div>
    </div>
    <div class="fui-content navbar">
        
        <div class="fui-tab fui-tab-warning" id="tab">
            <a ng-repeat="(k,v) in pagedata.status" ng-click="pagedata.params.status=k;tool.get_list('/order.refund/getlist/status='+k,true)" ng-class="{'active':pagedata.params.status==k}" href="javascript:;">{{v}}</a>
			
        </div>
		<div class="fui-list-group order-item" style="padding-bottom:0.5rem" ng-repeat="item in pagedata.list">
				<div class="fui-cell-group noborder">
					<div class="fui-cell">
						<div class="fui-cell-info">订单号: {{item.ordersn}}</div>
						<div class="fui-cell-remark">
							{{pagedata.status[item.status]}}
						</div>
					</div>
					<div class="fui-cell">
						<div class="fui-cell-label">Goods</div>
						<div class="fui-cell-text r" style="color:#999;font-size:0.65rem">
							<div ng-repeat="g in item.goods">
								<span ng-if="item.ordergoodsid<=0" class="syscolor">{{$index+1}}. </span>{{g.title}}<span ng-if="g.selespename" class="syscolor">. [{{g.selespename}}]</span>
							</div>
						</div>
					</div>
					<div class="fui-list">
						<div ng-if="item.price>0" class="fui-cell-info"><i class="icon icon-trade" style="font-size: 0.65rem"></i> 申请{{item.typetitle}}：{{item.price}}</div>
						<div ng-if="item.price<=0" class="fui-cell-info"><i class="icon icon-trade" style="font-size: 0.65rem"></i> 申请{{item.typetitle}}</div>
					</div>
					<div class="fui-list">
						<div class="fui-cell-info"><i class="icon jinyunicon icon-clock" style="font-size: 0.65rem"></i> 申请时间：{{item.createtime}}</div>
					</div>
					<div class="fui-list" ng-if="item.reason">
						<div class="fui-cell-info"> <i class="icon jinyunicon icon-trade" style="font-size: 0.65rem"></i> 审核说明：{{item.reason}}</div>
					</div>
				</div>				
            <div class="fui-list-group-title lineblock opblock">
				<span class="status noremark" style="float:right">
					<div ng-if="item.status == 1 && item.type <= 2" class="btn btn-sm btn-default-o order-delete" href="javascript:" ng-click="access_json('//send/id='+item.id)">退货Goods发货</div>
					<div ng-if="item.status == 0" class="btn btn-sm btn-danger-o order-finish" href="javascript:" ng-click="post({id:item.id},'jy_weishop_en/order.refund/cancel/')">cancel申请</div>
					<div ng-if="item.status == 5" class="btn btn-sm btn-danger-o order-finish" href="javascript:" ng-click="access_json('jy_weishop_en/order.refund/apply/orderid='+item.orderid+'&ordergoodsid='+item.ordergoodsid)">重新申请</div>
					<div ng-if="item.status == 0" class="btn btn-sm btn-danger-o order-finish" href="javascript:" ng-click="access_json('jy_weishop_en/order.refund/apply/orderid='+item.orderid+'&ordergoodsid='+item.ordergoodsid)">重新编辑</div>
				</span>
            </div>
        </div>
		<div class='infinite-loading' style="display:none" id="loading_show"><span class='fui-preloader'></span><span class='text'> Loading...</span></div>
		<div class="content-empty" ng-show="pagedata.list.length == 0 || !pagedata.list">
		  <i class="icon jinyunicon icon-cry" style="width: 6rem;margin-bottom: 0.5rem;"></i><br/><p style="color: #999;font-size: .75rem">暂时没有退货申请！</p>
		</div>
	</div>
	<div ng-include="sys_html('common/_menu')"></div>
	<script>
	if(scope.pagedata.op=='list'){
		scope.tool.get_list('/order.refund/getlist/status='+scope.pagedata.params.status,true);
		scope.scroll_bottom=function(){
			scope.tool.get_list('/order.refund/getlist/status='+scope.pagedata.params.status);
		}
	}
	</script>
</div>
<style>
    .fui-footer .btn{
        border-radius: 1rem;
        margin-top: .6rem;
        min-width: 4.1rem;
    }
    .fui-footer{
        padding-right: .6rem;
    }
    .fui-footer .btn.btn-default-o {
        border-color: #666;
        color: #666;
    }
    .fui-title.r-group{
        background: #f3f3f3;
        margin: 0;
        padding: .5rem .6rem;
    }
    .fui-cell-group .fui-cell.noborder:before{
        border:0;
    }
	.jylabels {
		padding: 0 0.5rem;
		margin-left:0;
		margin-top:0;
		border-radius:0.2rem;
	}
</style>
<div class="fui-page fui-page-current" ng-if="pagedata.op=='apply'">
<div class="fui-header">  
    <div class="title">return申请</div>
    <div class="fui-header-right">&nbsp;</div>
</div>
<div class='fui-content'>
	<div class='jy-content' style="padding:0.5rem">
	<div class="fui-cell-group" style="margin-top:0">
			<div class="fui-cell">
				<div class="fui-cell-label">订单编号</div>
				<div class="fui-cell-text r">
					{{pagedata.order.ordersn}}
				</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label">状态</div>
				<div class="fui-cell-text r">
					{{pagedata.order.statustitle}}
				</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label">Goods</div>
				<div class="fui-cell-text r">
					<div ng-repeat="item in pagedata.order.goods">
						<span ng-if="!pagedata.ordergoodsid" class="syscolor">{{$index+1}}. </span>{{item.title}}<span ng-if="item.selespename" class="syscolor">. [{{item.selespename}}]</span>
					</div>
				</div>
			</div>
	</div>
	<div class="fui-cell-group">
			<div ng-if="pagedata.can_refund!=2" class="fui-cell">
				<div class="fui-cell-label" style="width: auto;">申请return方式？</div>
				<div class="fui-cell-info">
				</div>
				<div class="fui-cell-remark">
					<select id="applytype" ng-model="pagedata.item.type">
						<option ng-repeat="(key,value) in pagedata.refund_types" value="{{key}}" ng-selected="pagedata.item.type==key">申请{{value}}</option>
					</select>
				</div>
			 </div>
			<div class="fui-cell">
				<div class="fui-cell-label">问题类型</div>
				<div class="fui-cell-text">
					<span ng-repeat="(key,value) in pagedata.msgtypes" ng-class="{'jylabels jylabel-f3f3f3':1,'active':pagedata.item.msgtypes.indexOf(';'+value+';')>=0}" ng-click="duoxuans(value,pagedata.item,'msgtypes')">
						{{value}}
					</span>
				</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label">问题描述</div>
				<div class="fui-cell-info" >
					<textarea rows="3" placeholder="科学，理性，实事求是，准确的反馈问题，以便更好的得到处理！" ng-model="pagedata.item.content"></textarea>
				</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label">涉及Number</div>
				<div class="fui-cell-info" >
					<input type="text" class='fui-input' placeholder="选填" ng-model="pagedata.item.goodsnum"/>
				</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label">退费金额</div>
				<div ng-if="pagedata.item.type==4" class="fui-cell-info">
					$ {{pagedata.item.dispatchprice || '0.00'}}
				</div>
				<div ng-if="pagedata.item.type==0 || pagedata.item.type==3" class="fui-cell-info" style="display: -webkit-box;display: -webkit-flex;display: -ms-flexbox;display: flex;-webkit-box-align: center;-webkit-align-items: center;-ms-flex-align: center;align-items: center;">
					$<input type="number" id="price" value="{{pagedata.item.price}}" class='fui-input' placeholder="请输入需要退的金额" ng-model="pagedata.item.price" />
				</div>
			</div>
			<div ng-if="pagedata.item.type==0 || pagedata.item.type==3" class='fui-title'>
					<span class='text-danger'>*提示:您可退款的最大金额为${{pagedata.item.maxprice}}
					<span ng-if="pagedata.order.status>1">(含运费{{pagedata.order.dispatchprice || '0.00'}})</span>
					<span ng-if="pagedata.ordergoodsid>0">(扣除了优惠额)</span>
					</span>
			</div>
			<div ng-if="pagedata.order.status!=1" class="fui-cell">
				<div class="fui-cell-label">相关照片</div>
					<div class="fui-cell-info">
						<ul class="fui-images fui-images" id="images">
							<div ng-repeat="image in pagedata.item.images track by $index">
							<li style="background-image:url({{tomedia(image)}})" class="image">
							<span class="image-remove" ng-click="pagedata.item.images.splice($index,1)"><i class="icon icon-close"></i></span>
							</li>
							</div>
						</ul>
						<div  class="fui-uploader fui-uploader refund-container-uploader" ng-click="images(pagedata.item,'images')">  
					</div>
				</div>
			</div>
			<div ng-if="pagedata.order.status!=1" class="fui-cell">
				<div class="fui-cell-label">相关视频</div>
					<div class="fui-cell-info">
						<ul class="fui-images fui-images" id="images">
							<li ng-if="pagedata.item.videos" class="image">
							<video ng-src="{{tomedia(pagedata.item.videos)}}" style="width:4rem;height:4rem;background:#000"  x5-playsinline="" playsinline="" webkit-playsinline="" poster="" preload="auto"></video>
							</li>
						</ul>
						<div class="fui-uploader fui-uploader refund-container-uploader" ng-click="choose_source(pagedata.item,'videos','video');"></div>
					</div>
			</div>
			<div ng-if="pagedata.order.status!=1 && pagedata.demoimgs.length>0" class="fui-cell-title" style="padding-bottom:0">示例图片</div>
			<div ng-if="pagedata.order.status!=1 && pagedata.demoimgs.length>0" class="fui-cell">
					<div class="fui-cell-info">
						<ul class="fui-images fui-images" id="images">
							<div ng-repeat="image in pagedata.demoimgs" ng-click="previewImage(image,pagedata.demoimgs);">
							<li style="background-image:url({{tomedia(image)}})" class="image">
							</li>
							</div>
						</ul>
					</div>
				</div>
			</div>
	</div>
</div>
<div class="fui-navbar-tip" style="height:1.8rem">
<div class="fui-cellone sm" style="padding:0">
	<div class="fui-cellone-info" style='line-height:1.4;font-size:0.7rem'>
		<span class="text"><input type="checkbox" ng-checked="pagedata.item.checked==true" ng-model="pagedata.item.checked" name="checkbox" class="fui-radio fui-radio-danger cartmode check-item"/></span>
		<span class="text" ng-click="pagedata.show_xieyi=true;">请先阅读【售后协议】</span>
	</div>
</div>
</div>
<div class='fui-footer text-right'>
    <a class='btn btn-sm btn-danger-o btn-submit' ng-click="post(pagedata.item,pagedata.op)">提交申请</a>
    <a class="btn btn-sm btn-default-o back" ng-click="goback()">cancel</a>
</div>
<div ng-if="pagedata.show_xieyi" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<i class="closed icon icon-cuowu" style="font-size:1.2rem;" ng-click="pagedata.show_xieyi=false"></i>
			<div class="content-images" style="padding:0.5rem;height:20rem; overflow-y:scroll;">
					<div class="title bold" style="font-size:0.8rem">售后协议 / <small>Read Ggree</small></div>
					<div class="text" style="padding-top:0.5rem;font-size:0.7rem" ng-bind-html="trust(pagedata.refundset.xieyi)">
					</div>
			</div>
			<div class="modal-footer">
				<div ng-click="pagedata.show_xieyi=false;pagedata.item.checked=true" class="mod-check" style="width: 100%; margin: 0;">我已阅读</div>
			</div>
		</div>
	</div>
</div>
</div>
<div class='fui-page' id='page-refund-express' ng-if="pagedata.op=='send'">
    <div class="fui-header">
       
        <div class="title">退货</div>
        <div class="fui-header-right">&nbsp;</div>
    </div>
    <div class='fui-content margin'>
       
        <div class="fui-cell-group">
            <div class='fui-cell-title'>填写快递单号</div>
            <div class="fui-cell">
                <div class="fui-cell-label">快递公司</div>
                <div class="fui-cell-info"><select ng-model="pagedata.item.com">
                    <option value="0" data-name="其他快递">其他快递</option>
                    <option ng-repeat="value in pagedata.express_types" value="{{value.name}}" >{{value.name}}</option>
                </select></div>
            </div>
            <div class="fui-cell">
                <div class="fui-cell-label">快递单号</div>
                <div class="fui-cell-info"><input type="text" ng-model="pagedata.item.sn" class='fui-input' max="50"/></div>
            </div>
        </div>
		<div class="fui-cell-group">
			<div class='fui-cell-title'>退货相关信息</div>
			<div class="fui-cell">
				<div class="fui-cell-label">The contact</div>
				<div class="fui-cell-info">
					{{pagedata.refundset.username}}
				</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label">Contact phone</div>
				<div class="fui-cell-info">
					{{pagedata.refundset.mobile}}
				</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label">退货address</div>
				<div class="fui-cell-text">
					{{pagedata.refundset.addressinfo}}
				</div>
			</div>
		</div>

    </div>
    <div class='fui-footer text-right'>
        <div class="btn btn-sm btn-danger-o" id='express_submit'ng-click="post(pagedata.item,pagedata.op)">提交快递单号</div>
        <a class="btn btn-sm btn-default-o back" ng-click="goback()">返回</a>
    </div>
</div>
<script>
if(scope.pagedata.op=='apply'){
	scope.pagedata.item.needchecked=1;
}
scope.tool.get_list('/order.refund/getlist/',true);
scope.pagedata.scroll_bottom=function(){
	scope.tool.get_list('/order.refund/getlist/');
}
</script>